import request from '@/utils/request.js'

export function getAttractionsList(page, size, searchParams) {
  console.log('page',page,'size',size)
  return request.get(`/attractions/list/${page}/${size}`, {
    params: {
      scenicName: searchParams?.scenicName,
      scenicAddress: searchParams?.scenicAddress,
      status: searchParams?.status,
      openTime: searchParams?.searchTime[0],
      closeTime: searchParams?.searchTime[1]
    }
  })
}

/**
 * 删除景点id
 * @param attractionsId
 */
export function remove(attractionsId) {
  return request.delete(`/attractions/remove/${attractionsId}`)
}
/**
 * 批量删除景点信息
 *
 * @param ids
 */
export function removeBatchByAttrIds(attrIds) {
  console.log('批量删除景点信息ids=====',attrIds)
  return request.delete('/attractions/batch', {
    data: attrIds
  })
}
/**
 * 新增景点信息
 * @param userInfo
 * @returns {Promise<axios.AxiosResponse<any>>}
 */
export function addAttra(attractions) {
  return request.post('/attractions/add', attractions)
}
/**
 * 修改景点信息
 * @param userInfo
 * @returns {Promise<axios.AxiosResponse<any>>}
 */
export function updateAttra(attractions) {
  console.log('修改景点信息11111',attractions)
  return request.put('/attractions/update', attractions)
}

/**
 * 详情
 * @param attractionsId
 * @returns {Promise<axios.AxiosResponse<any>>}
 */
export function detail(attractionsId) {
  return request.get(`/attractions/detail/${attractionsId}`)
}
